package com.example.rpc_core.protocal;

import lombok.Getter;

/**
 * 协议状态的状态枚举类
 */
@Getter
public enum ProtocolStatusCode {

    OK(200, "GoodProtocol"),
    BAD_REQUEST(401,"badRequest"),
    BAD_RESPONSE(402,"badResponse");

    private final String Message;
    private final int Status;

    ProtocolStatusCode(int Status, String Message){
        this.Message=Message;
        this.Status=Status;
    }

    /**
     * 遍历获取枚举类
     * @param Status
     * @return
     */
    public static ProtocolStatusCode getProtocolStatusCode(int Status){
        for (ProtocolStatusCode protocolStatusCode : ProtocolStatusCode.values()
             ) {
            if(protocolStatusCode.getStatus()==Status){
                return protocolStatusCode;
            }
        }
        return null;
    }


}
